<?php
class Presenter_model extends CI_Model {

	public function __construct()
	{
		$this->load->database();
	}

	public function create_presenter()
	{
		$data = array(
			'username' => $this->input->post('username'),
			'password' => sha1($this->input->post('password')),
			'type' => 'presenter',
			'field' => $this->input->post('field')
		);
		$this->db->insert('user', $data);
		$this->db->select('id');
		$query = $this->db->get_where('user',array('username'=>$this->input->post('username')));
		$result = $query->row();

		$data2 = array(
			'id' => $result->id,
			'name' => $this->input->post('name'),
			'cnic' => $this->input->post('cnic'),
			'organization' => $this->input->post('cnic'),
			'intro' => $this->input->post('intro')
		);
		return $this->db->insert('presenter', $data2);
	}
}
?>